﻿using Padsurface.App.Services.Interfaces;
using Padsurface.Audio.Song.Model;
using System;
using System.Composition;

namespace Padsurface.App.Services
{
    [Export(typeof(IActiveSongCache))]
    internal class ActiveSongCache : IActiveSongCache
    {
        private Song _activeSong;
        public Song ActiveSong
        {
            get
            {
                return _activeSong;
            }
            set
            {
                if (_activeSong == null) throw new InvalidOperationException();

                _activeSong = value;
            }
        }

        public void Clear()
        {
            _activeSong = null;
        }
    }
}
